package cloud.oss.upload;

import cloud.oss.upload.lsp.Ops;
import cloud.oss.upload.lsp.Sub;
import com.alibaba.fastjson.JSON;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @title: OSSUploadExample
 * @description:
 * @author: guan.xin
 * @create: 2022-04-08 12:08
 * @since: JDK8
 */
public class OSSUploadExample {

    /**
     * 店铺编码映射租户转换关系
     */
    public static final AtomicReference<Map<String, ValueEntity>> VE1 = new AtomicReference<>(new HashMap<>(8196));

    /**
     * 库存主体编码映射租户转换关系
     */
    public static final AtomicReference<Map<String, ValueEntity>> VE2 = new AtomicReference<>(new HashMap<>(4096));

    /**
     * 中台租户编码映射租户转换关系
     */
    public static final AtomicReference<Map<String, ValueEntity>> VE3 = new AtomicReference<>(new HashMap<>(256));


    public static void main(String[] args) {
//        System.out.println(VE1.get());
//        ValueEntity ve1 = new ValueEntity();
//        ve1.setUserId(1L);
//        ve1.setUserName("A");
//        ValueEntity ve2 = new ValueEntity();
//        ve2.setUserId(2L);
//        ve2.setUserName("B");
//        ValueEntity ve3 = new ValueEntity();
//        ve3.setUserId(1L);
//        ve3.setUserName("C");
//        Map<String, ValueEntity> map = new HashMap<>();
//        map.put(ve1.getUserName(), ve1);
//        map.put(ve2.getUserName(), ve2);
//        map.put(ve3.getUserName(), ve3);
//
//        VE1.set(map);
//
//        System.out.println(VE1.get());
//        System.out.println(VE1.get().get("A"));
//        System.out.println(VE1.get().get("B"));
//        System.out.println(VE1.get().get("C"));

//        Sub sub = new Sub();
//        sub.extend();
//
//        System.out.println(JSON.toJSONString(sub.get()));

//        Map<String, Object> map = new HashMap<>();
//        map.put("IT后端测试店铺Converse", new Object());
//
//        System.out.println(map.get("IT后端测试店铺Converse"));
//        System.out.println(map.get("IT后端测试店铺Converse"));
    }

    public static class ValueEntity {

        private Long userId;

        private String userName;

        public Long getUserId() {
            return userId;
        }

        public ValueEntity setUserId(Long userId) {
            this.userId = userId;
            return this;
        }

        public String getUserName() {
            return userName;
        }

        public ValueEntity setUserName(String userName) {
            this.userName = userName;
            return this;
        }
    }
}
